<template>
  <div>
    <div style="display: inline-block">
      <span v-for="(item, index) in num" :key="index">
        <input v-model="num1" :value="item" type="checkbox" />{{ item }}</span>
  </div>
    <br>
    你选中的元素，累加和为:
    <span>{{total}}</span>
  </div>
</template>

<script>
export default {
  name: 'VuecliDemoApp',

  data() {
    return {
    num: [9, 15, 19, 25, 29, 31, 48, 57, 62, 79, 87],
    num1:[]
    };
  },

  mounted() {
    
  },
methods: {},
  computed: {
    total(){
       return this.num1.reduce((sum, item) => {
        return sum + item;
      }, 0);
    }
  },
};
</script>

<style>

</style>